<template>
<div><button @click="handleTab">切换</button></div>
  <!-- <keep-alive>
    <nameZujian v-if="flag"></nameZujian>
    <pswzujian v-else></pswzujian>
  </keep-alive> -->
  <!-- include 指定缓存的组件 exclude 指定不缓存的组件 max设置最大缓存组件数 -->
  <keep-alive :exclude="['name']">
    <nameZujian v-if="flag"></nameZujian>
    <pswzujian v-else></pswzujian>
  </keep-alive>
</template>

<script lang="ts" setup>
import nameZujian from "./nameZujian.vue";
import pswzujian from "./pswzujian.vue";
import { ref } from "vue";
let flag = ref(true);
const handleTab = () => {
  flag.value = !flag.value;
};
</script>

<style>
</style>